import { Tag, Image } from 'ant-design-vue';
import type { TableColumn } from '@/components/core/dynamic-table';

export type TableListItem = API.archiveQueryPageResultItem;
export type TableColumnItem = TableColumn<TableListItem>;

const checkerName = (sponsor, organizer) => {
  if (sponsor && organizer) {
    return sponsor + '，' + organizer;
  } else if (sponsor == '') {
    return organizer;
  } else if (organizer == '') {
    return sponsor;
  }
};

export const aqColumns: TableColumnItem[] = [
  {
    title: '关键词',
    dataIndex: 'keyword',
    hideInTable: true,
    formItemProps: {
      labelWidth: 55,
      componentProps: () => {
        return {
          placeholder: '可输入单位名称、案件编号搜索',
          autocomplete: 'off',
          disabledLabelWidth: true,
        };
      },
    },
  },
  {
    title: '时间筛选',
    dataIndex: 'rangePicker',
    hideInTable: true,
    formItemProps: {
      component: 'RangePicker',
      componentProps: () => {
        return {
          format: 'YYYY/MM/DD',
          valueFormat: 'YYYY/MM/DD',
        };
      },
    },
  },
  {
    title: '案件编号',
    align: 'left',
    dataIndex: 'caseCode',
    hideInSearch: true,
  },
  {
    title: '单位名称',
    align: 'left',
    dataIndex: 'placeName',
    hideInSearch: true,
  },
  // {
  //   title: '简要案情',
  //   align: 'left',
  //   dataIndex: 'caseBrief',
  //   hideInSearch: true,
  // },
  {
    title: '执法机构',
    align: 'left',
    dataIndex: 'agencyName',
    hideInSearch: true,
  },
  {
    title: '执法人员',
    align: 'left',
    dataIndex: 'sponsor',
    hideInSearch: true,
    customRender: ({ record }) => checkerName(record.sponsor, record.organizer),
  },
  {
    title: '提交时间',
    align: 'left',
    dataIndex: 'createTime',
    hideInSearch: true,
  },
];
